#pragma once
// {3812F923-31DB-4043-83C0-7B5CF83895A7}

static const GUID CLSID_H263Decodec = 
{ 0x3812f923, 0x31db, 0x4043, { 0x83, 0xc0, 0x7b, 0x5c, 0xf8, 0x38, 0x95, 0xa7 } };



const AMOVIESETUP_MEDIATYPE sudPinTypes263 =
{
    &MEDIATYPE_Video,       // Major type
    &MEDIASUBTYPE_NULL      // Minor type
};

const AMOVIESETUP_PIN psudPins263[] =
{
    {
        L"Input",           // String pin name
        FALSE,              // Is it rendered
        FALSE,              // Is it an output
        FALSE,              // Allowed none
        FALSE,              // Allowed many
        &CLSID_NULL,        // Connects to filter
        L"Output",          // Connects to pin
        1,                  // Number of types
        &sudPinTypes263 },     // The pin details
      { L"Output",          // String pin name
        FALSE,              // Is it rendered
        TRUE,               // Is it an output
        FALSE,              // Allowed none
        FALSE,              // Allowed many
        &CLSID_NULL,        // Connects to filter
        L"Input",           // Connects to pin
        1,                  // Number of types
        &sudPinTypes263        // The pin details
    }
};

const AMOVIESETUP_FILTER sudH263Decodec =
{
    &CLSID_H263Decodec,        // Filter CLSID
    L"Video Contrast",      // Filter name
    MERIT_DO_NOT_USE,       // Its merit
    2,                      // Number of pins
    psudPins263                // Pin details
};


	
class CH263Decodec : public CTransformFilter
{
public:
	CH263Decodec(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
	~CH263Decodec(void);
public:
	static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
	
	DECLARE_IUNKNOWN;
	HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
    HRESULT CheckInputType(const CMediaType *mtIn);
    HRESULT CheckTransform(const CMediaType *mtIn,const CMediaType *mtOut);
    HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
    HRESULT DecideBufferSize(IMemAllocator *pAlloc,
                             ALLOCATOR_PROPERTIES *pProperties);
	HRESULT Transform(AM_MEDIA_TYPE *pType, const signed char ContrastLevel) const;
    HRESULT Transform(IMediaSample *pMediaSample);

	CCritSec m_ContrastLock;

	AVCodecContext av_context;
	AVCodec *av_codec;
};
